//======================================================================================
//  Apache License, Version 2.0
//  Notes:Use this command to anonymously check out the latest project source code:
//  Non-members may check out a read-only working copy anonymously over HTTP.
//  SVN checkout http://YHHLineCommandWsp.googlecode.com/svn/trunk/ 
//
//  Author:		Kevin Yang
//  Email:		Bigearrabbit@qq.com
//
//  DATE:		2013-4-6
//
//  File Name:	YHHELineCommandFatherEdit.cpp
//
//  Notes:
//  Provide implementation to interface
//    CATIEdit
//
//===================================================================

// Local FrameWork
#include "YHHELineCommandFatherEdit.h"
#include "YHHLineCommandCmd.h" // needed to return the Line Command edition command

// YHHLineCommandFrm Framework
#include "YHHILineCommandChild.h"     // needed to build the command from the Line Command to edit

//System Framework
#include "CATCommand.h"

CATImplementClass ( YHHELineCommandFatherEdit ,
                    DataExtension           ,
                    CATIEdit          ,
                    YHHLineCommandChild            );

// Tie the implementation to its interface by BOA
// ----------------------------------------------
CATImplementBOA(CATIEdit, YHHELineCommandFatherEdit);

// 
// To declare that YHHLineCommandChild implements CATIEdit , insert 
// the following line in the interface dictionary :
//
// YHHLineCommandChild      CATIEdit    libYHHLineCommandUI

//-----------------------------------------------------------------------------
// YHHELineCommandFatherEdit : constructor
//-----------------------------------------------------------------------------
YHHELineCommandFatherEdit::YHHELineCommandFatherEdit()
{
}

//-----------------------------------------------------------------------------
// YHHELineCommandFatherEdit : destructor
//-----------------------------------------------------------------------------
YHHELineCommandFatherEdit::~YHHELineCommandFatherEdit()
{
}




//-----------------------------------------------------------------------------
// Implements CATIEdit::Activate
//-----------------------------------------------------------------------------
CATCommand * YHHELineCommandFatherEdit::Activate (CATPathElement *ipPath)
{

    // gets a pointer on YHHILineCommandChild in edition
    YHHILineCommandChild *piLineCommand = NULL;
    HRESULT rc = QueryInterface ( IID_YHHILineCommandChild, (void**) &piLineCommand);
    if ( FAILED(rc) )         return NULL;
    
    // creates the edition command
    CATCommand *pCommand =  new YHHLineCommandCmd( piLineCommand );
    
    // releases useless pointer
    if ( NULL != piLineCommand )
    {
       piLineCommand->Release();
       piLineCommand = NULL ;
    }
    
    return pCommand;
}

